<template>
	<view>
		<view class="content" v-for="(item,index) in listData" :key="index">
			<view class="time-content">
				{{item.timer}}
			</view>
			<view class="Info-content">
				<text class="msg1">{{item.msg1}}</text>
				<text class="msg2">{{item.msg2}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				backData: [{
					timer: "",
					msg1: "您有一个新的订单！",
					msg2: "您有一个新的订单，快去接单吧！"
				}, {
					timer: "",
					msg1: "恭喜您，接单成功！",
					msg2: "恭喜您，接单成功，您当前距离客户300m！"
				}, {
					timer: "",
					msg1: "您的订单开始服务！",
					msg2: "您的订单已开始服务！"
				}, {
					timer: "",
					msg1: "您有一个新的转单！",
					msg2: "您的订单已付款，请等待陪护员接单！"
				}, {
					timer: "",
					msg1: "您的订单取消！",
					msg2: "您的订单已被取消，请查看！"
				}, {
					timer: "",
					msg1: "您的订单已完成！",
					msg2: "您的订单已完成，请等待客服评价！"
				}, {
					timer: "",
					msg1: "您的订单已评价！",
					msg2: "您的订单已评价，请查看！"
				}],
				listData: [{
					timer: "",
					msg1: "您有一个新的订单！",
					msg2: "您有一个新的订单，快去接单吧！"
				}, {
					timer: "",
					msg1: "恭喜您，接单成功！",
					msg2: "恭喜您，接单成功，您当前距离客户300m！"
				}, {
					timer: "",
					msg1: "您的订单开始服务！",
					msg2: "您的订单已开始服务！"
				}, {
					timer: "",
					msg1: "您有一个新的转单！",
					msg2: "您的订单已付款，请等待陪护员接单！"
				}, {
					timer: "",
					msg1: "您的订单取消！",
					msg2: "您的订单已被取消，请查看！"
				}, {
					timer: "",
					msg1: "您的订单已完成！",
					msg2: "您的订单已完成，请等待客服评价！"
				}, {
					timer: "",
					msg1: "您的订单已评价！",
					msg2: "您的订单已评价，请查看！"
				}]
			}
		},
		methods: {
			setDate() {
				let date = new Date();
				let m = date.getMonth() + 1;
				let d = date.getDay();
				let h = date.getHours();
				let M = date.getMinutes();
				let timer = m + "月" + d + "日" + " " + h + ":" + M;
				return timer;
			},

		},
		created() {
			this.listData.forEach((item) => {
				item.timer = this.setDate()
			})
		},
		onNavigationBarButtonTap(e) {
			if (e.text == '清空') {
				this.listData = ""
			}
		},
		onPullDownRefresh() {
			this.listData = ""
			setTimeout(() => {
				this.backData.forEach((item) => {
					item.timer = this.setDate()
				})
				this.listData = this.backData;
				uni.stopPullDownRefresh();
			}, 2000);

		}
	}
</script>

<style lang="less" scoped>
	.content {
		width: 95%;
		display: flex;
		flex-direction: column;
		margin: 50rpx auto;
		align-items: center;

		& .time-content {
			background-color: #F2F2F2;
			color: #929292;
			font-size: 28rpx;
			width: 200rpx;
			border-radius: 305rpx;
			text-align: center;
		}

		& .Info-content {
			display: flex;
			flex-direction: column;
			width: 100%;
			box-shadow: 0rpx 0rpx 20rpx #bababa;
			height: 140rpx;
			justify-content: center;
			margin-top: 24rpx;
			border-radius: 10rpx;
			padding-left: 16rpx;
			box-sizing: border-box;
		}

		& .msg2 {
			font-size: 28rpx;
			color: #929292;
			margin-top: 4rpx;
		}

	}
</style>
